﻿using System;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Windows;
namespace WPFExcelReport
{
    public partial class THR20ITX
    {
        #region ==CMTR===========
        public static readonly DependencyProperty CMTRProperty = DependencyProperty.Register("CMTR",
        typeof(double), typeof(THR20ITX),
        new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnCMTRChanged));
        public double CMTR
        {
            get
            {
                return (double)GetValue(CMTRProperty);
            }
            set
            {
                SetValue(CMTRProperty, value);
            }
        }
        private static void OnCMTRChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as THR20ITX;
            if (src != null)
            {
                src.CMTR = (double)e.NewValue;
            }
        }
        public virtual void OnCMTRChg(double value)
        {
            if (!IsUBT)
                return;
            QTY = CMTR;
        }
        #endregion 
        public THR20ITX()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            MV = new VHRSTAMM();
            this.DataContext = MV;
            InitializeComponent();
        } 

        private void WVER_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
        {
          
        }
        public override void OnQTYChg(double value)
        {
           
            base.OnQTYChg(value);
        }
        public override void ShiftProdctionCommand(object sender, RoutedEventArgs e)
        {
            if (dwMain == null)
            { }
            KEY = "";
            if (dwHR != null)
            {
                KEY = dwHR["HRBENID"].ToString().Trim().PadRight(10)
                    + dwHR["HRNNAME"].ToString().Trim().PadRight(10)
                    + MachineName.Trim().PadRight(10)
                    + SHIFT.Trim().PadRight(10)
                    + SHIFT.Trim().PadRight(10)
                    + SHIFT.Trim().PadRight(10)
                    + QTY.ToString().Trim().PadRight(10);
                QTY = 0;
                ART = "";
                TBMain.Clear();
            }
        }
    }
    
}
